package robocup.component.actions;

/**
 * This action is used to set the heterogeneous player types by the coach, and
 * to change the players during game. Generally, it assigns a player-type (<code>PConf</code>)
 * to each own player. An exchange during game additionally refreshes the agents
 * stamina, effort and recovery values (only allowed three times per game).
 */
public class ChangePlayerTypeAction
    extends Action {

  /**
   * The tricot number of the player, to whom a player-type should be assigned.
   * This is one of [1,11]. Note that the goalie isn't able to be heterogeneous.
   */
  private int _player;

  /**
   * The id of the player-type, which should be assigned to the player. This is
   * a integer value from 0 to 6.
   */
  private int _pType;

  /**
   * Constructs a new ChangePlayerTypeAction.
   * 
   * @param the
   *          player number (1-11)
   * @param the
   *          player type (0-6)
   */
  public ChangePlayerTypeAction(
      final int player,
      final int pType) {

    this._player = player;
    this._pType = pType;
    this._type = TYPE.COACH_CHANGE_PLAYER_TYPE;
  }

  /**
   * Returns the actions string representation:
   * 
   * @return (change_player_type &lt;player-num&gt; &lt;player-type&gt;)
   */
  @Override
  public String toString() {

    final StringBuffer buf = new StringBuffer();
    buf.append("(change_player_type ");
    buf.append(this._player);
    buf.append(" ");
    buf.append(this._pType);
    buf.append(")");
    return buf.toString();
  }

  /**
   * @return Returns the player.
   */
  public final int getPlayer() {

    return this._player;
  }

  /**
   * @return Returns the pType.
   */
  public final int getPType() {

    return this._pType;
  }
}
